package Ep06_BinaryTree.BT15_0404;

import Ep06_BinaryTree.TreeNode;

public class Mine {
    public int sumOfLeftLeaves(TreeNode root) {
        if(root == null || (root.left == null && root.right == null)) return 0;
        int leftValue = sumOfLeftLeaves(root.left);
        int rightValue = sumOfLeftLeaves(root.right);

        int value = 0;
        if (root.left != null && root.left.left == null && root.left.right == null){
            value = root.left.val;
        }
        return value + leftValue + rightValue;
    }
}
